package com.room.search.repository;

import com.room.search.domain.RoomCommunity;
import com.room.search.domain.RoomFile;
import com.room.search.domain.RoomGoods;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * Spring Data SQL repository for the RoomFile entity.
 */
@SuppressWarnings("unused")
@Repository
public interface RoomFileRepository extends JpaRepository<RoomFile, Long> {
    Optional<RoomFile> findByFileName(String fileName);

    List<RoomFile> findAllByCommunityAndFileName(RoomCommunity community, String fileName);

    List<RoomFile> findAllByGoodsAndFileName(RoomGoods roomGoods, String fileName);

    List<RoomFile> findAllByCommunity(RoomCommunity community);

    List<RoomFile> findAllByGoods(RoomGoods goods);


    Optional<RoomFile> findAllByFileUrl(String url);

}
